package com.atguigu.demo;

import sun.applet.Main;

/**
 * @author gjl
 * @create 2021-04-23 14:20
 */
public class Demo {
    public static void main(String[] args) {

        Ticket ticket = new Ticket();

        new Thread(() -> {
            for (int i = 1; i < 31; i++) ticket.sale();
        }, "t2").start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 31; i++) {
                    ticket.sale();
                }
            }
        }, "t1").start();

        new Thread(() -> {
            for (int i = 0; i < 31; i++) ticket.sale();
        }, "t3").start();
    }
}
